<?php

	defined('_JEXEC') or die('Restricted access');

	// Hent de seneste 5 nyheder. ->
		$db =& JFactory::getDBO();

		$query = 'SELECT #__content.title, #__content.publish_up 
		FROM #__content 
		JOIN #__categories ON #__content.catid = #__categories.id 
		WHERE #__categories.title = "Nyheder" AND #__content.state = 1 
		ORDER BY #__content.publish_up DESC 
		LIMIT 0,5';
		
		$db->setQuery($query);
		$rows = $db->loadObjectList();

	// Output. ->
		echo '<b>Seneste nyheder</b>:
		<ol>';
			foreach($rows as $nyhed){
				$publish = explode(' ', $nyhed->publish_up);
				echo'<li><a href="'.JURI::root().'index.php/nyheder"><b>'.$nyhed->title.'</b></a></li>
				<ul>
					<li>'.$publish[0].'</li>
				</ul>';
			}
		echo'</ol>';

	//-^

?>